﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class SupplierW
    {
        string supplierID;
        string supplierName;
        string contactName;
        int phoneNo;
        int faxNo;
        string gSTRegNo;
        string address;
        string email;

        [DataMember]
        public string SupplierID
        {
            get { return supplierID; }
            set { supplierID = value; }
        }

        [DataMember]
        public string SupplierName
        {
            get { return supplierName; }
            set { supplierName = value; }
        }

        [DataMember]
        public string ContactName
        {
            get { return contactName; }
            set { contactName = value; }
        }

        [DataMember]
        public int PhoneNo
        {
            get { return phoneNo; }
            set { phoneNo = value; }
        }

        [DataMember]
        public int FaxNo
        {
            get { return faxNo; }
            set { faxNo = value; }
        }

        [DataMember]
        public string GSTRegNo
        {
            get { return gSTRegNo; }
            set { gSTRegNo = value; }
        }

        [DataMember]
        public string Address
        {
            get { return address; }
            set { address = value; }
        }

        [DataMember]
        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        public static SupplierW convert(Supplier supplier)
        {
            SupplierW u = new SupplierW();

            u.SupplierID = supplier.SupplierID;
            u.SupplierName = supplier.SupplierName;
            u.ContactName = supplier.ContactName;
            u.PhoneNo = supplier.PhoneNo;
            u.FaxNo = supplier.FaxNo;
            u.GSTRegNo = supplier.GSTRegNo;
            u.Address = supplier.Address;
            u.Email = supplier.Email;

            return u;
        }

        public static List<SupplierW> convertList(List<Supplier> list)
        {
            List<SupplierW> listW = new List<SupplierW>();

            foreach (Supplier x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
 }
